<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>

    <link href="../css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="../css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="../css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="../css/animate.css" rel="stylesheet">
    <link href="../css/style.css?v=4.1.0" rel="stylesheet">

    <style type="text/css">
        .td-label{
            width: 6em;
            text-align: right;
            padding-right: 5px;
        }
    </style>
</head>
<body class="ibox-content">

    <table>
        <tr>
            <td class="td-label">变量名：</td>
            <td><input type="text" class="form-control" id="data-variate"></td>
            <td class="td-label">默认行数：</td>
            <td><input type="number" class="form-control" id="data-size" min="1"></td>
        </tr>
        <tr><td colspan="4" style="height: 10px;"></td></tr>
        <tr>
            <td class="td-label">自动增长：</td>
            <td colspan="3"><input type="checkbox" class="i-checks" id="data-growth"></td>
        </tr>

    </table>

    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <!--页面中一定要引入internal.js为了能直接使用当前打开dialog的实例变量-->
    <!--internal.js默认是放到dialogs目录下的-->
    <script type="text/javascript" src="../js/plugins/ueditor/dialogs/internal.js"></script>
    <!-- iCheck -->
    <script src="../js/plugins/iCheck/icheck.min.js"></script>
    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });
        dialog.oncancel = function () {

        };
        dialog.onok = function (){
            var variate = $('#data-variate').val();
            if($.isEmptyObject(variate))
                return;

            var node = editor.selection.getRange().getCommonAncestor();
            var tr = $(node).parents('tr');
            if(tr.length == 0)
                return;

            tr.attr("foreach",'');
            tr.attr("data-variate",variate);
            tr.attr("data-size",$('#data-size').val());
            tr.attr("data-growth",$('#data-growth').val());
        }
    </script>
</body>
</html>